
module.exports = {
	param :{
		currentPage:1, //页数
		pageSize:20, //每页条数
		total:0, //总条数,
		currentCount:0 //总页数
	},
	pager:function(options){
		for(var i in options){
			this.param[i] = options[i];
		}
		this.param.currentPage = this.param.currentPage <= 0 ? 1 : this.param.currentPage; 
		this.param.currentCount = Math.ceil(this.param.total / this.param.pageSize); //总页数
		var start , end;
		end = this.param.currentPage * this.param.pageSize;	//最后条数索引
		//如果最后索引，大于总条数最后索引
		if(end > this.param.total){
			end = this.param.total;
		}
		start = (this.param.currentPage-1) * this.param.pageSize;
		return {
			start : start,
			end:end
		};
	}
};